<?php
namespace Common\Model;
use Think\Model;
class FeedbackModel extends Model{
	/**
	 * 添加反馈记录
	 * @param [type] $user_id     用户ID
	 * @param [type] $category_id 类别ID
	 * @param [type] $type        类型：free_agreement免费合同
	 * @param [type] $object_id   对象ID
	 * @param [type] $content     内容
	 */
	public function submit($user_id, $user_type, $category_id, $type, $object_id, $content, $contact = '', $realname = ''){

		$city_info = D('User')->get_user_city_info($user_id);
		$data['province_id'] = $city_info['province_id'];
		$data['city_id']     = $city_info['city_id'];
		$data['user_id']     = $user_id ? $user_id : 0;
		$data['user_type']   = $user_type ? $user_type : 'user';
		$data['category_id'] = $category_id ? $category_id : 0;
		$data['type']        = $type ? $type : 'free_agreement';
		$data['object_id']   = $object_id ? $object_id : 0;
		$data['contact']     = $contact ? $contact : '';
		$data['realname']    = $realname ? $realname : '';
		$data['content']     = $content ? $content : '';
		$data['app_type']    = $app_type ? $app_type : '';
		$data['create_time'] = time();
		$this->add($data);
	}
}